package android.support.v4.media.session;

import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.os.ResultReceiver;
import android.support.v4.media.MediaDescriptionCompat;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import o.u;
import o.y;
import o.y.d;

public class MediaSessionCompat {
    private final MediaControllerCompat ॱ;

    public static final class QueueItem implements Parcelable {
        public static final Creator<QueueItem> CREATOR = new Creator<QueueItem>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˏ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ˏ(i);
            }

            public QueueItem ˏ(Parcel parcel) {
                return new QueueItem(parcel);
            }

            public QueueItem[] ˏ(int i) {
                return new QueueItem[i];
            }
        };
        private Object ˊ;
        private final MediaDescriptionCompat ˎ;
        private final long ˏ;

        private QueueItem(Object obj, MediaDescriptionCompat mediaDescriptionCompat, long j) {
            if (mediaDescriptionCompat == null) {
                throw new IllegalArgumentException("Description cannot be null.");
            } else if (j == -1) {
                throw new IllegalArgumentException("Id cannot be QueueItem.UNKNOWN_ID");
            } else {
                this.ˎ = mediaDescriptionCompat;
                this.ˏ = j;
                this.ˊ = obj;
            }
        }

        QueueItem(Parcel parcel) {
            this.ˎ = (MediaDescriptionCompat) MediaDescriptionCompat.CREATOR.createFromParcel(parcel);
            this.ˏ = parcel.readLong();
        }

        public void writeToParcel(Parcel parcel, int i) {
            this.ˎ.writeToParcel(parcel, i);
            parcel.writeLong(this.ˏ);
        }

        public int describeContents() {
            return 0;
        }

        public static QueueItem ˊ(Object obj) {
            if (obj == null || VERSION.SDK_INT < 21) {
                return null;
            }
            return new QueueItem(obj, MediaDescriptionCompat.ˊ(d.ˎ(obj)), d.ˊ(obj));
        }

        public static List<QueueItem> ˋ(List<?> list) {
            if (list == null || VERSION.SDK_INT < 21) {
                return null;
            }
            List<QueueItem> arrayList = new ArrayList();
            for (Object ˊ : list) {
                arrayList.add(ˊ(ˊ));
            }
            return arrayList;
        }

        public String toString() {
            return "MediaSession.QueueItem {Description=" + this.ˎ + ", Id=" + this.ˏ + " }";
        }
    }

    @RestrictTo({RestrictTo.d.ˏ})
    public static final class ResultReceiverWrapper implements Parcelable {
        public static final Creator<ResultReceiverWrapper> CREATOR = new Creator<ResultReceiverWrapper>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˊ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ˏ(i);
            }

            public ResultReceiverWrapper ˊ(Parcel parcel) {
                return new ResultReceiverWrapper(parcel);
            }

            public ResultReceiverWrapper[] ˏ(int i) {
                return new ResultReceiverWrapper[i];
            }
        };
        ResultReceiver ˋ;

        ResultReceiverWrapper(Parcel parcel) {
            this.ˋ = (ResultReceiver) ResultReceiver.CREATOR.createFromParcel(parcel);
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            this.ˋ.writeToParcel(parcel, i);
        }
    }

    @RestrictTo({RestrictTo.d.ˊ})
    @Retention(RetentionPolicy.SOURCE)
    public @interface SessionFlags {
    }

    public static final class Token implements Parcelable {
        public static final Creator<Token> CREATOR = new Creator<Token>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˎ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ॱ(i);
            }

            public Token ˎ(Parcel parcel) {
                Object readParcelable;
                if (VERSION.SDK_INT >= 21) {
                    readParcelable = parcel.readParcelable(null);
                } else {
                    readParcelable = parcel.readStrongBinder();
                }
                return new Token(readParcelable);
            }

            public Token[] ॱ(int i) {
                return new Token[i];
            }
        };
        private Bundle ˊ;
        private u ˋ;
        private final Object ˏ;

        Token(Object obj) {
            this(obj, null, null);
        }

        Token(Object obj, u uVar) {
            this(obj, uVar, null);
        }

        Token(Object obj, u uVar, Bundle bundle) {
            this.ˏ = obj;
            this.ˋ = uVar;
            this.ˊ = bundle;
        }

        public static Token ˏ(Object obj) {
            return ˎ(obj, null);
        }

        @RestrictTo({RestrictTo.d.ˊ})
        public static Token ˎ(Object obj, u uVar) {
            if (obj == null || VERSION.SDK_INT < 21) {
                return null;
            }
            return new Token(y.ˊ(obj), uVar);
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            if (VERSION.SDK_INT >= 21) {
                parcel.writeParcelable((Parcelable) this.ˏ, i);
            } else {
                parcel.writeStrongBinder((IBinder) this.ˏ);
            }
        }

        public int hashCode() {
            if (this.ˏ == null) {
                return 0;
            }
            return this.ˏ.hashCode();
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof Token)) {
                return false;
            }
            Token token = (Token) obj;
            if (this.ˏ == null) {
                if (token.ˏ != null) {
                    return false;
                }
                return true;
            } else if (token.ˏ == null) {
                return false;
            } else {
                return this.ˏ.equals(token.ˏ);
            }
        }

        public Object ॱ() {
            return this.ˏ;
        }

        @RestrictTo({RestrictTo.d.ˊ})
        public u ˎ() {
            return this.ˋ;
        }

        @RestrictTo({RestrictTo.d.ˊ})
        public void ॱ(u uVar) {
            this.ˋ = uVar;
        }

        @RestrictTo({RestrictTo.d.ˊ})
        public void ˋ(Bundle bundle) {
            this.ˊ = bundle;
        }
    }

    public MediaControllerCompat ˏ() {
        return this.ॱ;
    }

    @RestrictTo({RestrictTo.d.ˊ})
    public static void ˏ(@Nullable Bundle bundle) {
        if (bundle != null) {
            bundle.setClassLoader(MediaSessionCompat.class.getClassLoader());
        }
    }
}
